Skip to content

Conversation

@fivetran-ashashankar
Copy link
Collaborator

DuckDB

Ignores %x because locale-dependent formats are not supported.
Providing support to match the bigquery format mm/dd/yy

@fivetran-ashashankar fivetran-ashashankar force-pushed the RD-1050269-annotate-type-for-FORMAT_DATE branch from 2480db8 to 6a781d7 Compare November 20, 2025 19:00
@fivetran-ashashankar fivetran-ashashankar force-pushed the RD-1050269-annotate-type-for-FORMAT_DATE branch from 1d7f43e to 4514a5c Compare November 21, 2025 22:26
@georgesittas georgesittas changed the title feat(snowflake)!: %x is treated a literal in duckdb. support %x loca… feat(duckdb)!: transpile bigquery's %x format literal Nov 24, 2025
write={
"bigquery": "SELECT FORMAT_DATETIME('%x', '2023-12-25 15:30:00')",
"duckdb": "SELECT STRFTIME(CAST('2023-12-25 15:30:00' AS TIMESTAMP), '%x')",
"duckdb": "SELECT STRFTIME(CAST('2008-12-25' AS DATE), '%m/%d/%y')",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this change to a date? how did that happen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this change to a date? how did that happen?
not done with testing yet. Testing with various inputs . I have some tests that are failing. Working on it.
Will update the file asap

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post the changes made in bigquery.py the following test is failing .

self.validate_all( "SELECT FORMAT_DATETIME('%x', '2023-12-25 15:30:00')", write={ "bigquery": "SELECT FORMAT_DATETIME('%x', '2023-12-25 15:30:00')", "duckdb": "SELECT STRFTIME(CAST('2023-12-25 15:30:00' AS TIMESTAMP), '%m/%d/%y')", }, )

when the matching in trie happens -> %D is resolved as the canonical token.
My understanding is write-> bigquery should be updated to "bigquery": "SELECT FORMAT_DATETIME('%D', '2023-12-25 15:30:00')",

let me know if its okay.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%x and %X should be canonical, let's switch the order, that should fix the test

this=expr_type(this=seq_get(args, 1)),
format=seq_get(args, 0),
zone=seq_get(args, 2),
# "bigquery")(expr_type(... -> "bigquery")([expr_type(...])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this comment

done

**Dialect.DATE_PART_MAPPING,
"DAYOFWEEKISO": "ISODOW",
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this new line

@georgesittas georgesittas merged commit 62f3982 into main Nov 26, 2025
8 checks passed
@georgesittas georgesittas deleted the RD-1050269-annotate-type-for-FORMAT_DATE branch November 26, 2025 09:16
georgesittas pushed a commit that referenced this pull request Nov 26, 2025
* feat(snowflake)!: %x is treated a literal in duckdb. support %x  locale-dependent formats.

* feat(snowflake)!: %x is treated a literal in duckdb. support %x  locale-dependent formats.

* Revert "feat(snowflake)!: %x is treated a literal in duckdb. support %x  locale-dependent formats."

This reverts commit 4514a5c.

* Revert "feat(snowflake)!: %x is treated a literal in duckdb. support %x  locale-dependent formats."

This reverts commit a2400e8.

* feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb

* feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb

* feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb

* feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb

* feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb

* feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants